<extend name="Public:iframe" />
<block name="content">
    <form class="layui-form" action="">
        <div class="layui-form-item">
            <label class="layui-form-label">权限名称</label>
            <div class="layui-input-block">
                <input type="text" name="name" required  lay-verify="required" placeholder="请输入权限名称" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="button" class="layui-btn" lay-submit lay-filter="save">保存</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>

</block>

<block name="foot_script">
    <script>
        $(layui.use(['layer','form','upload'], function(){
            var layer = layui.layer,form = layui.form,upload = layui.upload;


            form.on('submit(save)',function (data) {
                $.post('{:U("Adminrole/add")}',data.field,function (res) {
                    if (res.code === 1){
                        layer.msg(res.msg,{time:1000},function () {
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                            // parent.layui.table.reload('dataTable');
                        });
                    } else {
                        layer.msg(res.msg,{time:1000});
                    }
                });
                return false;
            });

        }));

    </script>
</block>